<?php
session_start();
require_once("../db_connect.php");
$thread_contribute_name = array();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet"  href="../../css/css.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.corner.js"></script>
<script type="text/javascript">
</script>
</head>
<body>
	<div id="container">
<div id="header" class="box4">
<div id="header_box">
<div id="title"></div>
<div id="search_box"><a href="#" id="volunteer">ボランティア</a>｜<a href="#"
	id="thread">掲示板</a>
<form method="post"
	action="search_function/search_display.php?target=volunteer"
	id="target"><input type="text" name="search_word"><br />
<input type="submit" value="検索する" id="search_button"></form>
</div>
</div>
</div>
		<div id="rightnavi" class="box">
		<?php if(empty($_SESSION["user_name"])&&empty($_SESSION["user_id"])){?>
			<h3>ログインフォーム</h3>
			<form method="post" action="./user_function/UserLogin.php">
				ID：　　<input type="text" name="id" size="10"><br />
				PASS：<input type="text" name="pass" size="10"><br />
				<input style="margin:10px 0 0 39px;" type="image" src="../img/login.png" alt="送信ボタン" name="submit" align="middle">
			</form>
			<a  href="./PHP/User_create.php"><img style="margin:-20px 0 0 39px;" src="../img/newuser.png" border="0"></a>
		<?php }else{?>
				<img src="../../img/kaiinlogo.png" id="kaiinlogo" />
				<p>ようこそ<?php echo $_SESSION['nick_name']?>さん！</p>
				<p><a href="user_infomation.php">会員情報表示</a></p>
				<p><a href="user_update.php">会員情報変更</a></p>
				<p><a href="user_display_application.php">申請中ボランティア</a></p>
				<p><a href="user_display_volunteer.php">提供中ボランティア</a></p>
				<p><a href="../volunteer_function/volunteer_information_insert.php">ボランティア作成</a></p>
				<p><a href="logout.php">ログアウト</a></p>
				<br />
		<?php }?>
		<img src="../../img/keizilogo.png" id="keizilogo" />
<ul class="menu_margin">
<div id="thread_title_look">
<?php

	//スレッド項目取得
	$sql = "SELECT t.thread_id,count(thread_name) as thread_count,t.thread_name,max(r.response_date) as response_date,t.thread_id FROM thread AS t LEFT OUTER JOIN response AS r ON t.thread_id = r.thread_id group by t.thread_name order by response_date desc limit 0,5";
	$sth = $db->query($sql);
	if (DB::isError($sth)) {
	  exit($sth->getMessage());
	}

	//スレッド表示
	while ($data = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
	  echo "<li><a href='../response.php?thread_id=".$data['thread_id']."'>";
	  echo mb_strlen($data['thread_name'])>=9?mb_substr($data['thread_name'],0,9)."...":$data['thread_name'];
	  echo "</a></li>";
	}
?>
				</ul>
		<div id="more"><a href="../PHP/thread.php" >もっと見る...</a></div>
	</div>
<div id="main"  class="box3">
<?php
	$volunteer_information_id  = htmlspecialchars($_GET['volunteer_information_id'],ENT_QUOTES,"UTF-8").",";

	$sth = "SELECT v.volunteer_information_id,v.volunteer_name,v.sub_category_id,v.content,v.age,v.target_gender,v.work_time,v.updata_date,v.posted_date,v.activity_date,v.end_time,v.location,v.access,v.conditions,v.application_number,v.treatment_id,u.group_name,u.information,u.url,u.group_id
			FROM volunteer_information v,user u
			WHERE v.user_id=u.user_id
			AND	  v.volunteer_information_id=?";

	$data = array($volunteer_information_id);

	$res =& $db->query($sth, $data);	//SQLを実行して、結果を $res に代入
	if (PEAR::isError($res)) {			//SQLの実行に失敗すればここでエラー文を出力
		die($res->getMessage());
	}
	while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) {	//SQLの実行結果を表示
	    echo $row['volunteer_name'];   	//テーブルの項目名を指定?><br><br><br>
	    [カテゴリ番号]・・・・・・・・
	    <?php echo $row['sub_category_id'];?><br><br>
	    [活動内容]・・・・・・・・・・・
		<?php echo $row['content'];?><br><br>
		[対象年齢]・・・・・・・・・・・
		<?php echo $row['age'];?>歳<br><br>
		[対象性別]・・・・・・・・・・・
	    <?php echo $row['target_gender'];?><br><br>
	    [勤務時間]・・・・・・・・・・・
		<?php echo $row['work_time'];?><br><br>
		[投稿更新日時]・・・・・
		<?php echo $row['updata_date'];?><br><br>
	    [投稿終了日時]・・・・・
	    <?php echo $row['posted_date'];?><br><br>
	    [活動時間]・・・・・・・・
		<?php echo $row['activity_date'];?><br><br>
		[終了時間]・・・・・・・・
		<?php echo $row['end_time'];?><br><br>
		[活動場所]・・・・・・・・・
	    <?php echo $row['location'];?><br><br>
	    [移動手段]・・・・・・・・・
		<?php echo $row['access'];?><br><br>
		[条件]・・・・・・・・・・
		<?php echo $row['conditions'];?><br><br>
	    [情報提供者ID]・・・・・
	    <?php echo $row['application_number'];?><br><br>
	    [待遇]・・・・・・・・・・
		<?php echo $row['treatment_id'];?><br><br>
		[グループ名]・・・・・・・・・・
		<?php echo $row['group_name'];?><br><br>
		[団体照会文]・・・・・・・・・・
		<?php echo $row['information'];?><br><br>
		[ユーアールエル]・・・・・・・・・・
		<?php echo $row['url'];?><br><br>
		[団体分類]・・・・・・・・・・
		<?php echo $row['group_id'];?><br><br>
	<?php }
?>
</div>
<div id="space"></div>
</div>
</body>
</html>
